package Demo1;
import java.sql.*;

public class StudentCount {
    public static void main(String[] args) {
        DbUtil db =new DbUtil();
        db.load();
        System.out.println("学生总人数为:"+db.studentCount());








        /*//统计学生总数,并输出
        try {
            Class.forName("com.mysql.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        String url ="jdbc:mysql://localhost:3306/kgc76?useSSL=false";
        Connection conn =null;
        PreparedStatement ps =null;
        ResultSet rs =null;
        try {
            conn= DriverManager.getConnection(url,"root","123456");
            String sql ="select count(1) from s_student";
            ps= conn.prepareStatement(sql);
            rs = ps.executeQuery();
            while (rs.next()){
                int anInt = rs.getInt(1);
                System.out.printf("学生总数有:%d人。",anInt);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        finally {
            try {
                rs.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
            try {
                ps.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
            try {
                conn.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }*/


    }
}
